<template>
  <!-- 自定义图标 -->
  <van-popup
    class="win-info-popup"
    v-model="showprizePop"
    closeable
    close-icon="close"
  >
  <div class="win-info-contanier" v-if="info.is_win == 1 ">
    <div class="win-prize-info" v-if="info.is_win == 1 ">
      <div class="win-prize-level">{{prize_info.prize_level_name}}</div>
       <!-- 商品 -->
      <div class="win-prize-goods-img" v-if="prize_info.type == 1">
        <img :src="prize_info.prize_pic.img_path" alt="">
      </div>
      <!-- 优惠券 -->
      <div class="win-prize-coupon" v-else>
        <div class="win-prize-coupon-left" v-if="prize_info.promotion_type==0" v-html="scaleGoodsPriceFn(prize_info.name_value)"></div>
        <div class="win-prize-coupon-left" v-else>{{prize_info.name_value}}</div>
        <div class="win-prize-coupon-right">
          <!-- <p>{{prize_info.name}}</p> -->
          <p>{{prize_info.use_time}}</p>
        </div>
      </div>
      <div class="win-prize-title">{{prize_info.name}}</div>
    </div>
    <div class="win-info-bottom" v-if="info.is_expire == 0">
      <div class="title">恭喜你中奖啦</div>
      <div class="btn" @click="getPrize">领取</div>
      <p>7天内领取，超时作废</p>
    </div>
    <div class="win-info-bottom" v-if="info.is_expire == 1">
      <div class="title">恭喜你中奖啦</div>
      <div class="btn" @click="close">超时未领裙</div>
    </div>
  </div>
  <div class="win-info-contanier" v-else>
    <div class="win-prize-info" >
      <div class="not-win-prize"></div>
    </div>
    <div class="win-info-bottom">
      <div class="title">很遗憾你未中奖</div>
      <div class="btn" @click="close">知道了</div>
      <p>下次活动再接再厉</p>
    </div>
  </div>
  </van-popup>
</template>

<script>
import Vue from 'vue'
import { scaleGoodsPrice } from '@/utils/index'

import { Popup } from 'vant'

Vue.use(Popup)
export default Vue.extend({ 
  props: {
    info: {
      type: Object,
      default: {}
    },
    prize_info: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      showprizePop: false
    }
  },
  methods: {
    scaleGoodsPriceFn(price, className) {
      return scaleGoodsPrice(price, className)
    },
    getPrize() {
      this.close()
    },
    close() {
      this.showprizePop = false
      this.$parent.getLuckDraw()
    }
  }
})
</script>
<style lang="scss">
@import "src/styles/mixin";
.win-info-popup{
  width: 672px;
  height: 792px;
  top: 45%;
  overflow: initial;
  background: url(https://img.wifenxiao.com/h5-wfx/images/activity/win_popup.png) center/cover no-repeat;
  .van-popup__close-icon{
    font-size: 70px;
    color: #FFFFFF;
    top: 100%;
    right: 50%;
    transform: translate(50%,50%);
  }
  .win-prize-info{
    position: absolute;
    // width: 380px;
    height: 228px;
    top: 232px;
    left: 50%;
    transform: translateX(-45%);
    .win-prize-level,.win-prize-title{
      font-size: 28px;
      font-weight: 500;
      color: #4C4C4C;
      text-align: center;
      @include showEllipsis;
    }
    .win-prize-goods-img{
      width: 130px;
      height: 130px;
      overflow: hidden;
      border-radius: 5px;
      margin: 20px auto;
      img{
        width: 100%;
      }
    }
    .win-prize-coupon{
      margin: 15px 0;
      width: 360px;
      height: 112px;
      background: url(https://img.wifenxiao.com/h5-wfx/images/activity/coupon_2.png) center/cover no-repeat;
      .win-prize-coupon-left{
        text-align: center;
        line-height: 56px;
        white-space: nowrap;
        font-size: 28px;
        font-weight: bold;
        @include showEllipsis;
        span{
          &.unit{
            color: #9D521B;
            font-size: 22px;
          }
          &.num-font{
            color: #B26616;
            font-size: 36px;
          }
          &.num-back{
            color: #B26616;
            font-size: 22px;
          }
        }
      }
      .win-prize-coupon-right{
       line-height: 56px;
       text-align:center;
        p{
          &:last-child{
            font-size: 24px;
            color: #AC5925;
            // line-height: 18px;
            @include showEllipsis;
            text-align: center;
          }
        }
      }
    }
    .not-win-prize{
      width: 320px;
      height: 228px;
      margin: 0 auto;
      background: url(https://img.wifenxiao.com/h5-wfx/images/activity/not_win_prize.png) center/cover no-repeat;
    }
  }
  .win-info-bottom{
    position: absolute;
    top: 520px;
    left: 50%;
    transform: translateX(-45%);
    .title{
      text-align: center;
      font-size: 32px;
      font-weight: 500;
      color: #FFFFFF;
      line-height: 44px;
    }
    .btn{
      margin: 12px auto;
      width: 332px;
      height: 82px;
      line-height: 82px;
      text-align: center;
      font-size: 32px;
      font-weight: 500;
      color: #814405;
      background: url(https://img.wifenxiao.com/h5-wfx/images/activity/send_btn.png) center/cover no-repeat;
    }
    p{
      text-align: center;
      font-size: 26px;
      color: #FFFFFF;
    }
  }
}
</style>